<template>
  <div>
    <h3>axios</h3>
    <ul>
      <li v-for="(item,index) in data" :key="index">
        <p>{{ item.stu_id }}</p>
        <p>{{ item.stu_name }}</p>
        <img 
          :style="{width: 100 + 'px',height: 100 + 'px'}"
          :src="item.stu_head_img != '' ? item.stu_head_img : img_url" alt="">
      </li>
    </ul>
  </div>
</template>

<script>
import axios from "axios";
  export default {
    data(){
      return{
        data:[],
        //路径 图片引入要用require
        img_url : require("./assets/logo.png"),
      };
    },
    mounted(){
      axios.get("http://localhost:8000/search_info").then((res)=>{
        console.log(res);
        console.log(res.data);
        this.data = res.data;
      }).catch((err)=>{
        console.log(err);
      })
    }
  }
</script>

<style lang="scss" scoped>

</style>